package ru.weho.bookitizer;

import java.awt.*;
import java.util.Locale;
import java.util.ResourceBundle;

import javax.swing.*;

import ru.weho.bookitizer.editor.EditorWindow;

/**
 * Bookitizer application class
 * @author Nik S Denin <wolf.step@gmail.com>
 */
public class Bookitizer 
{
	public static void main(final String[] args) throws Exception
	{
		SwingUtilities.invokeLater(new Runnable() {
			public void run()
			{
				createAndShowGUI(args);
			}
		});
	}

	static void createAndShowGUI(String[] args)
	{
		Locale currentLocale = Locale.getDefault();
		System.out.println("Locale is " + currentLocale.getCountry());
		ResourceBundle resourceBundle = ResourceBundle.getBundle("Bookitizer", currentLocale);

		EditorWindow mainWindow = new EditorWindow(resourceBundle.getString("APP_NAME"));
		mainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		mainWindow.setSize(1024, 768);

		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		Dimension frameSize = mainWindow.getSize();
		int x = (screenSize.width - frameSize.width) / 2;
		int y = (screenSize.height - frameSize.height) / 2;
		mainWindow.setLocation(x, y);
		mainWindow.setVisible(true);
	}
}
